<?php
/**
* @author Amasty Team
* @copyright Amasty
* @package Amasty_Flags
*/
class Amasty_Flags_Model_Order_Flag extends Mage_Core_Model_Abstract
{
    protected function _construct()
    {
        $this->_init('amflags/order_flag');
    }
    
    public function removeLinks($flag)
    {
        if ($flag->getId())
        {
            $collection = $this->getCollection()->addFieldToFilter('flag_id', array('eq' => $flag->getId()))->load();
            if ($collection->getSize())
            {
                foreach ($collection as $orderFlag)
                {
                    $orderFlag->delete();
                }
            }
        }
        return $this;
    }
}
